<?php

/**
 * Task form base class.
 *
 * @method Task getObject() Returns the current form's model object
 *
 * @package    mysmartmanager
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseTaskForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(	  
      'taskid'           => new sfWidgetFormInputHidden(),
      'shortsummary'     => new sfWidgetFormInputText(),
      'description'      => new sfWidgetFormTextarea(),
      'milestoneid'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Milestone'), 'add_empty' => false, 'table_method'=>'getMilestonesOfSelectedProject')),
      'prioritytype'     => new sfWidgetFormChoice(array('choices' => array('High'=>'High', 'Medium'=>'Medium', 'Low'=>'Low'))),
      'startdate'        => new sfWidgetFormJQueryDate(array('image' => '/images/calendar.jpg', 'date_widget' => new sfWidgetFormDate(array('format'=>'%day%/%month%/%year%'))
)),
      'estimatedenddate' => new sfWidgetFormJQueryDate(array('image' => '/images/calendar.jpg',
'date_widget' => new sfWidgetFormDate(array('format'=>'%day%/%month%/%year%'))
)),
      'actualenddate'    => new sfWidgetFormDateTime(),
      'resourceid'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Resource'), 'add_empty' => false)),
      'taskstatus'       => new sfWidgetFormChoice(array('choices' => array('Open'=>'Open', 'Close'=>'Close', 'Pending'=>'Pending'))),
      'createdate'       => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'taskid'           => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'taskid', 'required' => false)),
      'shortsummary'     => new sfValidatorString(array('max_length' => 255, 'required' => true)),
      'description'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'milestoneid'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Milestone'), 'required' => true)),
      'prioritytype'     => new sfValidatorString(array('max_length' => 75, 'required' => false)),
      'startdate'        => new sfValidatorDateTime(array('required' => true)),
      'estimatedenddate' => new sfValidatorDateTime(array('required' => true)),
      'actualenddate'    => new sfValidatorDateTime(array('required' => false)),
      'resourceid'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Resource'), 'required' => true)),
      'taskstatus'       => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'createdate'       => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('task[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Task';
  }

}
